FROM openjdk:8-jdk-alpine
MAINTAINER pader "nd521@qq.com"
ENV MODE="standalone" \
    PREFER_HOST_MODE="ip" \
    BASE_DIR="/home/nacos" \
    CLASSPATH=".:/home/nacos/conf:$CLASSPATH" \
    FUNCTION_MODE="all" \
    NACOS_USER="nacos" \
    JAVA="java" \
    JVM_XMS="2g" \
    JVM_XMX="2g" \
    JVM_XMN="1g" \
    JVM_MS="128m" \
    JVM_MMS="320m" \
    NACOS_DEBUG="n" \
    TOMCAT_ACCESSLOG_ENABLED="false" \
    TIME_ZONE="Asia/Shanghai"

# create nacos home dir
RUN mkdir -p /$BASE_DIR

WORKDIR /$BASE_DIR

# create nacos need dir
RUN mkdir -p target bin conf 

# copy file to dirs

COPY target target/
COPY bin bin/
COPY conf conf/

# set startup log dir
RUN mkdir -p logs \
	&& cd logs \
	&& touch start.out \
	&& ln -sf /dev/stdout start.out \
	&& ln -sf /dev/stderr start.out

RUN chmod +x bin/docker-startup.sh

EXPOSE 8848
ENTRYPOINT ["sh", "bin/docker-startup.sh"]
